home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-01 | 1.5 KB | 66 lines | [TEXT/DWat] |
- % Asymptote Demo #5
-
- % This script shows how to read data
- % from rows of a data file and plot
- % a histogram.
-
- datafile HST STARS
- fontname Times
- pensize .5
-
- % Choose which columns to read
- datacolumns 4 20
- % Then read them into x and y from rows 1 and 2
- readrow x 1
- readrow y 2
-
- % Close the datafile, we're done with it
- close \f
-
- graphlimits % Find the graph limits
- graphlimits xright xleft ybottom ytop % Then plot x backwards
- graphunits in
- graphframe 2 7 2 5
- fullscreen yes
-
- % Choose the fill pattern to fill under the histogram
- fillpat gray
- plothistogram 0.0 % Use 0.0 to for the baseline
-
- % Specify our own tick mark spacing in units we like
- graphticks .5 1 2e5 1e6
- ticksize 9 % Use 9 point ticks
-
- % Make the pen bigger and draw just the frame with no ticks or labels
- % This puts a thick border around the graph
- pensize 2
- drawframe inside inside noticks nolabels nolabels nolabels nolabels
-
- % Now draw the thin tick marks and tick mark labels
- pensize 0.25 % hairline
- % Specify a notation
- notation general
- % Now draw the frame
- drawframe
-
- % Set the scale factor to draw the title a bit bigger
- scale 1.5
- drawtitle HST Guide Star Catalog
-
- % Use a macro 'TL' (defined in the macros file) to move to the top right
- TR
- rpn <y sum >y
- digits 1
- drawlabel belowleft \y(1) Stars
-
- % Make the x and y labels a little smaller than the title
- scale 1
- drawxlabel Visual Magnitude
- drawylabel Number of Stars
-
- % Add a subtitle to the x axis by moving the frame down 0.25 inches
- graphframe gleft gright gbottom 0.25 - gtop
- scale 0.8
- drawxlabel Data read from rows of a file
-
-